<?php

/**
 * 后台菜单处理
 * Some rights reserved：abc3210.com
 * Contact email:admin@abc3210.com
 */
class MainAction extends AdminbaseAction {

    public function index() {
        $db = D('');
        $db = DB::getInstance();
        $tables = $db->getTables();
        //服务器信息
        $info = array(
            '操作系统' => PHP_OS,
            '运行环境' => $_SERVER["SERVER_SOFTWARE"],
            'PHP运行方式' => php_sapi_name(),
            'MYSQL版本' => mysql_get_server_info(),
            'ShuipFCMS版本' => SHUIPF_VERSION."&nbsp;&nbsp;&nbsp; [<a href='http://www.abc3210.com' target='_blank'>访问官网</a>]",
            '上传附件限制' => ini_get('upload_max_filesize'),
            '执行时间限制' => ini_get('max_execution_time') . "秒",
            '剩余空间' => round((@disk_free_space(".") / (1024 * 1024)), 2) . 'M',
        );
        
        $this->assign('server_info', $info);
        //会员信息
        $userinfos = $this->Cache['User'];

        $userinfo = array(
            '会员名' => $userinfos['username']."&nbsp;&nbsp;&nbsp;<a href='".U("Admin/Adminmanage/myinfo")."'> 修改资料</a>",
            '所属会员组' => $userinfos['role_name'],
            '最后登陆时间' => date("Y-m-d H:i:s", $userinfos['last_login_time']),
            '上次登陆IP' => $userinfos['last_login_ip'],
            '本次登陆IP' => get_client_ip()
        );
        $this->assign('userinfo', $userinfo);
        $Model = F('Model');
        foreach ($Model as $rw) {
            $molule = M(ucwords($rw['tablename']));
            $rw['counts'] = $molule->count();
            $moduledata[] = $rw;
        }
        $this->assign("moduledata",$moduledata);
        $this->display();
    }

    /**
     *  显示后台左侧导航
     */
    public function leftmain() {
        $parentid = (int) $this->_get("parentid");
        if ($parentid == 0) {
            $arid = current($this->Cache['Menu']);
            $Mune = $this->Cache['Menu'][$arid['id']]['lower'];
        } else {
            $Mune = $this->Cache['Menu'][$parentid]['lower'];
        }
        $this->assign("leftmain", $Mune);
        $this->display();
    }

}

?>
